package com.flysky.model.finance;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


@Entity
@Table(name="flysky_finance_bigtype")
public class BigTypeHbmModel implements Serializable{

	/**
	 * @author kp18166
	 */
	private static final long serialVersionUID = 1L;

	private int type_id;
	
	private String type_name;
	
	private Set<SmallTypeHbmModel> smallTypeSet;

	@Id
	@GeneratedValue(generator = "bigTypeGenerator")    
	@GenericGenerator(name = "bigTypeGenerator", strategy = "increment")
	@Column(name="type_id")
	public int getType_id() {
		return type_id;
	}

	public void setType_id(int type_id) {
		this.type_id = type_id;
	}

	@Column(name="type_name")
	public String getType_name() {
		return type_name;
	}

	public void setType_name(String type_name) {
		this.type_name = type_name;
	}
	
	@OneToMany(mappedBy="bigType",fetch =FetchType.EAGER)
	public Set<SmallTypeHbmModel> getSmallTypeSet() {
		return smallTypeSet;
	}

	public void setSmallTypeSet(Set<SmallTypeHbmModel> smallTypeSet) {
		this.smallTypeSet = smallTypeSet;
	}

	@Override
	public String toString() {
		return "BigTypeHbmModel [type_id=" + type_id + ", type_name="
				+ type_name + ", smallTypeSet=" + smallTypeSet + "]";
	}

	@Override
	public boolean equals(Object obj) {
		if(null == obj){
			return false;
		}
		if(!(obj instanceof BigTypeHbmModel)){
			return false;
		}
		BigTypeHbmModel bigType = (BigTypeHbmModel)obj;
		if(this.getType_id() == bigType.getType_id()){
			return true;
		}else{
			return false;
		}
	}

	
	
}
